#!/usr/bin/python
# -*- coding:utf-8 -*-
#script name: motionMatch_facial_templeLoc

'''

#  date   : 2015 / 05 / 09
#  author : lizhi 
#  founction : create temple locators for facial rig 


'''

import LZ_public_command.LZ_general_command as LZ_general_command
reload(LZ_general_command)



import maya.cmds as mc
class createTemple_motionMatch_facial(LZ_general_command.general_command):
    def __init__(self):
        pass 
        #-8.789
        
    def createMothTemple(self , prefix = '' ):
        self.mothTemples =    { 'mouth_all_templeloc':(0,-40.36,63.214),
                                'lf_mouth_conner_templeloc':(25.554,-40.674,47.9),
                                'lf_mouth_emotion_templeloc':(33.417,-41.915,44.346),
                                'mouth_upperlid_templeloc':(0,-31.638,63.214),
                                'mouth_lowerlid_templeloc':(0,-48.666,60.806),
                                'jaw_templeloc':(0,-8.789,-13.403),
                                'tooth_upper_templeloc':( 0,-31.431,26.166 ),
                                'tooth_lower_templeloc':(0,-49.327,26.166),
                                'tongue_01_templeloc':(0,-41.574,-21.499),
                                'tongue_02_templeloc':(0,-39.812,1.669),
                                'tongue_03_templeloc':(0,-45.179,21.361),
                                'tongue_04_templeloc':(0,-45.179,35.419),
                                
                                
                                }
        self.mouth_temples_grp = 'mouth_temple_grp'
        mouthTempleGrp = prefix +  self.mouth_temples_grp
        
        if mc.objExists(mouthTempleGrp) == False:
            mc.group(em=True ,n = mouthTempleGrp )
        
        mouthTemple_info = self.mothTemples
        for mt in mouthTemple_info:
            
            
            self.createTransformer( locName = prefix +  mt , position = mouthTemple_info[mt] , rotation = ( 0,0,0) ,type = 'locator',LocPosion = (0,0,0))
            mc.setAttr(str(prefix +  mt )+'.localScaleX' , 5 )
            mc.setAttr(str(prefix +  mt )+'.localScaleY' , 5 )
            mc.setAttr(str(prefix +  mt )+'.localScaleZ' , 5 )
            mc.parent( prefix +  mt , mouthTempleGrp )
            if 'lf_' in mt:
                rightLoc = str(prefix + mt).replace('lf_','rt_')
                rightPositon = (mouthTemple_info[mt][0]*-1, mouthTemple_info[mt][1],mouthTemple_info[mt][2])
                
                self.createTransformer( locName = rightLoc , position = rightPositon , rotation = ( 0,0,0) ,type = 'locator',LocPosion = (0,0,0))
                
                mc.setAttr(str(rightLoc)+'.localScaleX' , 5 )
                mc.setAttr(str(rightLoc)+'.localScaleY' , 5 )
                mc.setAttr(str(rightLoc)+'.localScaleZ' , 5 )
                mc.parent( rightLoc , mouthTempleGrp )
                
                
                
                
                
                